package com.ecoolex.ying.space.enums;

import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;
import com.ecoolex.ying.space.entity.EstateProjectActivityCouponPackage;

public enum EstateProjectActivityCouponPackageStatus implements EnumInterface<EstateProjectActivityCouponPackageStatus, Integer>{

	UNUSED(1, "待使用"),
	USED(2,"已使用"),
	EXPIRE(3, "已过期"),
    REFUND(4, "已退款");
    

	private int real;

	private String describe;

	private EstateProjectActivityCouponPackageStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	@Override
	public EstateProjectActivityCouponPackageStatus realOf(Integer real) {
		if (Check.notNull(real)) {
			for (EstateProjectActivityCouponPackageStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}
	
	public static boolean canRefund(EstateProjectActivityCouponPackage record) {
		return UNUSED.equal(record.getStatus()) || EXPIRE.equal(record.getStatus());
	}
}
